package com.cavy.platform.client;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * json数据统一返回为此格式
 */
@Data
@NoArgsConstructor
public class ResultInfo implements Serializable {
    private Object data;
    private boolean success = true;
    private List<ErrorItem> errors = new ArrayList<>();

    public ResultInfo(Object returnValue) {
        this.data = returnValue;
    }

    public static ResultInfo newSuccess() {
        return new ResultInfo(null);
    }
}
